/**
 * Created by lijingwen on 2015-02-15.
 */

function Bar(div,dataProvider,categoryField,valueField){
    AmCharts.makeChart(div, {
        "type": "serial",
        "theme": "lijingwen",
        "dataProvider": dataProvider,
        "startDuration": 1,
        "pathToImages":"http://42.96.157.54/eva/resource/javascript/amcharts/images/",
        "graphs": [{
            "balloonText": "<b>[[category]]: [[value]]</b>",
            "colorField": "color",
            "fillAlphas": 0.9,
            "fillColors":"#3398CC",
            "lineAlpha": 0.2,
            "type": "column",
            "valueField": valueField
        }],
        "chartCursor": {
            "categoryBalloonEnabled": false,
            "cursorAlpha": 0,
            "zoomable": false
        },

        "chartScrollbar": {
            'scrollbarHeight':10,
            backgroundColor: "#BDC3C7",
            graphFillColor: "#FFFFFF",
            selectedGraphFillColor: "#EBEDEF",
            selectedGraphLineColor: "#EBEDEF",
            selectedBackgroundColor: "#EBEDEF",
            gridAlpha: 0.15
        },
        "categoryField": categoryField,
        "categoryAxis": {
            "gridPosition": "start"
        },
        "amExport":{}

    });
}

function makeClassifyData() {
    var chart = AmCharts.makeChart("classify", {
        "type": "serial",
        "theme": "none",
        "legend": {
            "useGraphSettings": true
        },
        "pathToImages":"http://42.96.157.54/eva/resource/javascript/amcharts/images/",
        "chartScrollbar": {
            'scrollbarHeight':10,
            backgroundColor: "#BDC3C7",
            graphFillColor: "#FFFFFF",
            selectedGraphFillColor: "#EBEDEF",
            selectedGraphLineColor: "#EBEDEF",
            selectedBackgroundColor: "#EBEDEF",
            gridAlpha: 0.15
        },
        "dataProvider": classify_json,
        "valueAxes": [{
            "integersOnly": true,
            "axisAlpha": 0,
            "dashLength": 5,
            "gridCount": 10,
            "position": "left",
            "title": "各媒体报道量"
        }],
        "startDuration": 0.5,
        "graphs": [{
            "balloonText": "[[title]]: [[value]]",
            "bullet": "round",
            "title": "电视",
            "valueField": "电视",
            "fillAlphas": 0
        }, {
            "balloonText": "[[title]]: [[value]]",
            "bullet": "round",
            "title": "报纸",
            "valueField": "报纸",
            "fillAlphas": 0
        }, {
            "balloonText": "[[title]]: [[value]]",
            "bullet": "round",
            "title": "网络视频",
            "valueField": "网络视频",
            "fillAlphas": 0
        },
            {
                "balloonText": "[[title]]: [[value]]",
                "bullet": "round",
                "title": "门户",
                "valueField": "门户",
                "fillAlphas": 0
            },
            {
                "balloonText": "[[title]]: [[value]]",
                "bullet": "round",
                "title": "行业",
                "valueField": "行业",
                "fillAlphas": 0
            }
        ],
        "chartCursor": {
            "cursorAlpha": 0,
            "cursorPosition": "mouse",
            "zoomable": false
        },
        "categoryField": "date",
        "categoryAxis": {
            "gridPosition": "start",
            "axisAlpha": 0,
            "fillAlpha": 0.05,
            "fillColor": "#000000",
            "gridAlpha": 0,
            "position": "bottom"
        },
        "exportConfig": {
            "menuBottom": "15px",
            "menuRight": "15px",
            "menuItems": [{
                "icon": '/lib/3/images/export.png',
                "format": 'png'
            }]
        }
    });
}


function makeKeywordData(json){
    var chart = AmCharts.makeChart("list-xy-chart", {
        "type": "xy",
        "pathToImages": "http://www.amcharts.com/lib/3/images/",
        "theme": "关键词",
        "dataProvider": json,
        "valueAxes": [{
            "position":"bottom",
            "axisAlpha": 0
        }, {
            "axisAlpha": 0,
            "position": "left"
        }],
        "startDuration": 1.5,

        "graphs": [{
            "fillColors":"#FFD073",
            "labelText": "[[word]]",
            "balloonText": "[[word]]:<b>[[value]]</b>",
            "bullet": "circle",
            "bulletBorderAlpha": 0.2,
            "bulletAlpha": 0.8,
            "lineAlpha": 0,
            "fillAlphas": 0,
            "valueField": "value",
            "xField": "x",
            "yField": "y",
            "maxBulletSize": 150
        }]
    });    }